﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

//References COM file MicrosoftInternetControls
//Gets Current URL in Internet Exsplorer
//Some code from http://www.omegacoder.com/?p=63
namespace Sensors
{
    class IESensor
    {
        public void run()
        {
            SHDocVw.ShellWindows shellwindows = new SHDocVw.ShellWindowsClass();
            string filename;
            foreach (SHDocVw.InternetExplorer ie in shellwindows)
            {
                filename = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
                if (filename.Equals("iexplore"))
                    Console.WriteLine("URL : {0}", ie.LocationURL);

                if (filename.Equals("explorer"))
                    Console.WriteLine("Name : {0}",ie.LocationURL);
            }
        }
    }
}
